package spzx.cors;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class SpzxConfiguration implements WebMvcConfigurer {

    @Override
    public void addCorsMappings(CorsRegistry registry) {
        registry.addMapping("/**")  // 允许所有请求路径
                .allowedOriginPatterns("*")  // 允许所有来源跨域请求
                .allowedMethods("*")  // 允许所有方法
                .allowedHeaders("*")  // 允许所有头部
                .allowCredentials(true);  // 允许携带cookie
    }
}
